define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'mall.user/index',
        edit_url: 'mall.user/edit',
        export_url: 'mall.user/export',
        modify_url: 'mall.user/modify',
    };

    var Controller = {
        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh',
                    [],
                    'export'],
                cols: [[
                    {type: "checkbox"},
                    {field: 'id', width: 80, title: 'ID',search: false},
                    {field: 'openid', width: 100, title: '微信标识'},
                    {field: 'nickName', width: 100, title: '用户昵称'},
                    {field: 'avatarUrl',width: 100, title: '用户头像', templet: ea.table.image,search: false},
                    {field: 'mobile', width: 100, title: '用户手机号'},
                    {field: 'income', width: 100, title: '累计收入',search: false},
                    {field: 'balance', width: 100, title: '可结算收入',search: false},
                    {field: 'channelstatus', width: 100, title: '渠道商状态',selectList:{"0":"未申请","1":"待审核","2":"渠道商"}},
                    {field: 'channel_time', width: 120, title: '申请渠道商时间',search:false},
                    {field: 'renzhengstatus', width: 100, title: '认证状态',search: false},
                    {field: 'parent_name', width: 100, title: '推荐人',search: false},
                    {field: 'invite_code', width: 100, title: '邀请码'},
                    {field: 'create_time',  title: '创建时间', search: 'range'},
                    {
                        width: 240,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '编辑推荐人',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: 'data-full="true"',
                            }]
                        ]
                    }
                ]],
            });
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});